#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <aclconio.h>
#include <define.h>
#include <transact.h>
#include <tran.h>
#include <gds.h>
#include <sizes.h>
#include "ConfProto.h"
#include "tblutil.h"
#include <\SOFTPAY\Ver30\source\include\sizes.h>
#include <\SOFTPAY\Ver30\HostSrc\citisrc\citiids.h>
#include <\SOFTPAY\Ver30\HostSrc\cpacsrc\cpacids.h>
#include <confio.h>

#include <\SOFTPAY\Ver30\source\include\MIT.h>

const char*MITName = "MIT.dat";

static MIT_REC srMITRec;

static int recordNum;
int	inLoadMITRec (int inRecNumber)
{
	int inRet;

	inRet = inLoadConfRec(MIT_FILENAME, SIZE_MIT_REC, inRecNumber, (char *) &srMITRec);

	recordNum = inRecNumber;
	return inRet;
}

void *pvdGetMITRec(void)
{
	return &srMITRec;

}

int	inSaveMITRec (int inRecNumber)
{
	int inRet;

	inRet = inSaveConfRec(MIT_FILENAME, SIZE_MIT_REC, inRecNumber, (char *) &srMITRec);

	return inRet;
}

int	inGetMITRecNumber (void)
{
	return recordNum;
}

int	inUpdateMITRec (void)
{
	int inRet;

	inRet = inSaveConfRec(MIT_FILENAME, SIZE_MIT_REC, recordNum, (char *) &srMITRec);

	return inRet;
}

void	vdResetMITRec (void)
{
	memset((void*)&srMITRec, 0, REC_SIZEOF(srMITRec));
}

short inGetMerchantNum(void)
{
	return srMITRec.inMerchantNum;
}

void vdSetMerchantNum(short inMerchantNum)
{
	srMITRec.inMerchantNum = inMerchantNum;
}

char* szGetMerchantText(void)
{
	return srMITRec.szMerchantText;
}

void vdSetMerchantText(const char* szMerchantText)
{
	strNumCopy(srMITRec.szMerchantText, szMerchantText, sizeof(((MIT_REC*)NULL)->szMerchantText)-1);
}

char* szGetRctHdr1(void)
{
	return srMITRec.szRctHdr1;
}

void vdSetRctHdr1(const char* szRctHdr1)
{
	strNumCopy(srMITRec.szRctHdr1, szRctHdr1, sizeof(((MIT_REC*)NULL)->szRctHdr1)-1);
}

char* szGetRctHdr6(void)
{
	return srMITRec.szRctHdr6;
}

void vdSetRctHdr6(const char* szRctHdr6)
{
	strNumCopy(srMITRec.szRctHdr6, szRctHdr6, sizeof(((MIT_REC*)NULL)->szRctHdr6)-1);
}

char* szGetRctFoot4(void)
{
	return srMITRec.szRctFoot4;
}

void vdSetRctFoot4(const char* szRctFoot4)
{
	strNumCopy(srMITRec.szRctFoot4, szRctFoot4, sizeof(((MIT_REC*)NULL)->szRctFoot4)-1);
}

char* szGetMerchPasswd(void)
{
	return srMITRec.szMerchPasswd;
}

void vdSetMerchPasswd(const char* szMerchPasswd)
{
	strNumCopy(srMITRec.szMerchPasswd, szMerchPasswd, sizeof(((MIT_REC*)NULL)->szMerchPasswd)-1);
}

char* szGetAutoSettTime(void)
{
	return srMITRec.szAutoSettTime;
}

void vdSetAutoSettTime(const char* szAutoSettTime)
{
	strNumCopy(srMITRec.szAutoSettTime, szAutoSettTime, sizeof(((MIT_REC*)NULL)->szAutoSettTime)-1);
}

char* szGetAutoSettDate(void)
{
	return srMITRec.szAutoSettDate;
}

void vdSetAutoSettDate(const char* szAutoSettDate)
{
	strNumCopy(srMITRec.szAutoSettDate, szAutoSettDate, sizeof(((MIT_REC*)NULL)->szAutoSettDate)-1);
}

long lnGetInvNum(void)
{
	return srMITRec.lnInvNum;
}

void vdSetInvNum(long lnInvNum)
{
	srMITRec.lnInvNum = lnInvNum;
}

